home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / program / freeli22.zip / SPLIT.C < prev    next >
Text File  |  1996-09-01  |  814b  |  38 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. char s[160];
  5.  
  6. main(int argc, char *argv[])
  7. {
  8.       int ctr = 0;
  9.  
  10.       FILE *fp = NULL;
  11.  
  12.       while(!feof(stdin))
  13.       {
  14.             gets(s);
  15.  
  16.             if(s[0] == '~' && s[1] == '~' && s[2] == '~')
  17.             {
  18.                   if(fp)
  19.                   {
  20.                         printf(" ");
  21.                         if(!(ctr = (ctr + 1) % 6))
  22.                               printf("&\n");
  23.                         fclose(fp);
  24.                   }
  25.                   printf("+%s", s + 3);
  26.                   strcat(s, ".ASM");
  27.                   fp = fopen(s + 3, "wt");
  28.  
  29.             } else {
  30.                   if(fp) fprintf(fp, "%s\n", s);
  31.             }
  32.       }
  33.  
  34.       if(argc > 1) printf(" &");
  35.       printf("\n");
  36.       return 0;
  37. }
  38.